﻿// See https://aka.ms/new-console-template for more information
using Grpc.Net.Client;
using NETCORE.GrpcService;

Console.WriteLine("Hello, World!");

string url = "https://localhost:7180";   //https
using (var channel = GrpcChannel.ForAddress(url))
{
    var client = new Greeter.GreeterClient(channel);
    var reply = client.SayHello(new HelloRequest()
    {
        Name = "故里2130"
    });
    Console.WriteLine($"结果:message:{reply.Message}");
}
Console.ReadKey();
//AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);  //http调用
//string url = "http://localhost:5000";
//using (var channel = GrpcChannel.ForAddress(url))
//{
//    var client = new Greeter.GreeterClient(channel);
//    var reply = client.SayHello(new HelloRequest()
//    {
//        Name = "故里2130"
//    });
//    Console.WriteLine($"结果:message:{reply.Message}");
//}
//Console.ReadKey();